import { reactive, onMounted, onUnmounted } from 'vue'

// 获取鼠标位置
function getMouse_position() {
    const movement = reactive({
        mouse_move(e) {
            movement.x = e.clientX;
            movement.y = e.clientY;
        }
    });

    onMounted(() => {
        window.addEventListener("mousemove", movement.mouse_move)
    })

    onUnmounted(() => {
        window.removeEventListener("mousemove", movement.mouse_move)
    })

    return movement;
}

export { getMouse_position };